package com.gsnd.briuppts.web.controller;

import com.gsnd.briuppts.Result.Response;
import com.gsnd.briuppts.entity.VO.CountVO;
import com.gsnd.briuppts.service.AnalysisService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/analysis")
public class AnalysisController {
    @Autowired
    AnalysisService analysisService;
    @GetMapping("/count")
    public Response<CountVO> count(){
        CountVO analysisCount = analysisService.findAnalysisCount();
        return Response.success(analysisCount);
    }

    @ApiOperation("统计动物体重信息接⼝")
    @GetMapping("/indexCount")
    public Response getAnimalWeightInfo() {
        Map<String, Integer> result =
                analysisService.countWeight();
        return Response.success(result);
    }

    @ApiOperation("统计动物病症数量接口")
    @GetMapping("/countDisease")
    public Response getAnimalDiseased() {
        Map<String, Long> result = analysisService.countDisease();
        return Response.success(result);

    }

    @ApiOperation("统计本年度12个月销售动物接口")
    @GetMapping("/countSales")
    public Response countAnnualSales(){
        Map<String, List<Object>> result = analysisService.countSales();
        return Response.success(result);
    }

}
